package ru.gelin.android.multiplier;

public class Operation {

    public static enum Type {
        MUL, DIV;
    }

    double number1;
    double number2;
    Type type = Type.MUL;

    public double getNumber1() {
        return this.number1;
    }

    public double getNumber2() {
        return this.number2;
    }

    public Type getType() {
        return this.type;
    }

    public double getResult() {
        switch(this.type) {
            case MUL:
                return this.number1 * this.number2;
            case DIV:
                return this.number1 / this.number2;
        }
        return 0.0;
    }

    public void setNumber1(double number1) {
        this.number1 = number1;
    }

    public void setNumber2(double number2) {
        this.number2 = number2;
    }

    public void setType(Type type) {
        if (type == null) {
            throw new NullPointerException("Operation type cannot be null");
        }
        this.type = type;
    }


}
